# frozen_string_literal: true

class RuleOutput
  class Value < RuleOutput
    def deep_update(params)
      super

      create_formula!(params.require(:schema).slice(:type, :content)) if is_a?(RuleOutput::Dsl)
    end

    def validate(variable_type)
      raise "output.#{name} type error." unless variable_type.validate?(value)
    end

    def fire(_params)
      value
    end
  end
end
